/**
 * Copyright (C), 2015-2018, XXX有限公司
 * FileName: RoleConvert
 * Author:   zhouheng
 * Date:     2018/7/27 17:31
 * Description: 用户角色转换类
 * History:
 * <author>          <time>          <version>          <desc>
 * 作者姓名           修改时间           版本号              描述
 */
package com.hengby.hengcrud.core.util.poi.convert;

import com.hengby.hengcrud.core.common.factory.ConstantFactory;
import com.hengby.hengcrud.core.common.factory.IConstantFactory;
import com.hengby.hengcrud.core.util.SpringContextHold;
import com.hengby.hengcrud.modular.sys.mapper.RoleMapper;

/**
 * 〈一句话功能简述〉<br> 
 * 〈用户角色转换类〉
 *
 * @author zhouheng
 * @create 2018/7/27
 * @since 1.0.0
 */
public class RoleConvert implements ExportConvert{

    RoleMapper roleMapper = SpringContextHold.getBean(RoleMapper.class);

    @Override
    public String handler(Object val) {

        try {
            if (val == null) {
                return "";
            }else {
                // 查询字典表
                IConstantFactory constantFactory = ConstantFactory.me();
                String reurnStr = constantFactory.getRoleName(val.toString());
                return reurnStr;
            }
        } catch (Exception e) {
            e.printStackTrace();
            return "";
        }
    }
}